define([], function () {
    require([], function () {
    $(document).on('click', "[data-toggle='areapicker']", function () {
        var iscustomer =$(this).data('iscustomer')?$(this).data('iscustomer'):false;
        var that = this;
        var callback = $(that).data('callback');
        var input_name = $(that).data("input-name") ? $(that).data("input-name") : "";
        var input_val = $(that).data("input-val") ? $(that).data("input-val") : "";
        var name = input_name ? $("#" + input_name).val() : '';
        var val = input_val ? $("#" + input_val).val() : '';
        var datasource = $(that).data("datasource") ? $(that).data("datasource") : "";
        var url = "/addons/areapicker/index?iscustomer="+iscustomer+"&ds="+datasource;
        url += val ? '&val=' + val : '';
        Fast.api.open(url, '区域选择', {
            callback: function (res) {
                input_name && $("#" + input_name).val(res.name);
                input_val && $("#" + input_val).val(res.val);
                try {
                    if (typeof callback === 'function') {
                        callback.call(that, res);
                    }
                } catch (e) {

                }
            }
        });
    });
});
require.config({
    paths: {
        'fastflow-fastflow': "../addons/fastflow/js/fastflow",
		'fastflow-base': "../addons/fastflow/js/fastflowbase",
        'fastflow-fixed-columns': "../addons/fastflow/js/fastflow-fixed-columns",
		'fastflow-form-builder': "../addons/fastflow/js/form-builder",
    },
    shim: {
        'fastflow': {
            exports: 'fastflow'
        },
        'fastflow-fixed-columns':{
            deps: ['bootstrap-table'],
        }
    }
});

if (Config.modulename === 'admin' && Config.controllername === 'index' && Config.actionname === 'index') {
    $.ajax({
        type: "POST",
        url: "fastflow/flow/bill/getBadge",
        data: {},
        dataType: "json",
        success: function (data) {
            if (data['code'] == 1) {
                data['data'].forEach(function (item) {
                    if (item['count'] > 0) {
                        $('a[addtabs=' + item['id'] + ']').append('<span class="pull-right-container fastflow-badge" style="margin-right: 20px"> <small class="' + item['shape'] + ' pull-right ' + item['color'] + '">' + item['show'] + '</small></span>');
                    }
                });
            }
        }
    });
}




require.config({
    paths: {
        'jquery-colorpicker': '../addons/wanlshop/js/jquery.colorpicker.min',
        'jquery-autocomplete': '../addons/wanlshop/js/jquery.autocomplete',
        'jquery-jqprint': '../addons/wanlshop/js/jquery.jqprint-0.3.min',
		'jquery-migrate': '../addons/wanlshop/js/jquery.migrate-1.2.1.min',
		'vue': '../addons/wanlshop/js/vue.min',
		'chat': '../addons/wanlshop/js/vue.min',
		'sortablejs': '../addons/wanlshop/js/Sortable.min',
		'vuedraggable': '../addons/wanlshop/js/vuedraggable.umd.min',
		'clipboard': '../addons/wanlshop/js/clipboard.min'
    },
    shim: {
        'jquery-colorpicker': {
            deps: ['jquery'],
            exports: '$.fn.extend'
        },
        'jquery-autocomplete': {
            deps: ['jquery'],
            exports: '$.fn.extend'
        },
		'jquery-jqprint': {
		    deps: ['jquery'],
		    exports: '$.fn.extend'
		},
		'jquery-migrate': {
		    deps: ['jquery'],
		    exports: '$.fn.extend'
		},
        'vue': {
            deps: ['jquery'],
            exports: '$.fn.extend'
        },
		'chat': {
		    deps: ['css!../addons/wanlshop/css/chat.css'],
		    exports: '$.fn.extend'
		},
        'sortablejs': {
            deps: ['jquery'],
            exports: '$.fn.extend'
        },
        'vuedraggable': {
            deps: ['jquery'],
            exports: '$.fn.extend'
        },
		'clipboard': {
		    deps: ['jquery'],
		    exports: '$.fn.extend'
		}
    }
});
// 后台全局添加 IM即时通讯

});